<?php

/**
 * sfSimpleForumAbuseLog form.
 *
 * @package    cpfaizenay
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrinePluginFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class sfSimpleForumAbuseLogForm extends PluginsfSimpleForumAbuseLogForm
{
  public function configure()
  {
      $user = sfContext::getInstance()->getUser()->getGuardUser();

      $dateWidget = new sfWidgetFormI18nDate(array(
          'format' => '%day%/%month%/%year%',
//          'month_format' => 'short_name',
          'culture' => 'fr'
        ));

        if($this->isNew()) {
            $this->widgetSchema['updated_at'] = new sfWidgetFormInputHidden();
            $this->widgetSchema['modification_user_id'] = new sfWidgetFormInputHidden();

            $this->setDefault('user_id', $user->getId());

            $this->setDefault('created_at', date('d-m-Y') );
            $this->setDefault('updated_at', date('d-m-Y') );
        }else{
            $this->widgetSchema['updated_at'] = new sfWidgetFormJQueryDate(array(
              'culture' => 'fr',
              'date_widget' => $dateWidget,
              'image' => '/images/admin/icons/small/calendar.png',
              'config' => '{}',
            ));
            $this->getObject()->set('user_id', $user->getId());
        }

        $this->widgetSchema['created_at'] = new sfWidgetFormJQueryDate(array(
          'culture' => 'fr',
          'date_widget' => $dateWidget,
          'image' => '/images/admin/icons/small/calendar.png',
          'config' => '{}',
        ));
  }
}
